﻿using System;
using System.Windows.Forms;
using LDSCore;
using LDSModel.Dal;

namespace LDSProject.Forms
{
    public partial class OpLogForm : Form
    {
        public OpLogForm()
        {
            InitializeComponent();
        }

        private void OpLogForm_Load(object sender, EventArgs e)
        {
            var bs = new BindingSource { DataSource = OpType.Login.ToList() };
            cbOpType.DataSource = bs;
            cbOpType.ValueMember = "Key";
            cbOpType.DisplayMember = "Value";

            dtStartTime.MaxDate = DateTime.Now;
            dtEndTime.MaxDate = DateTime.Now;

            btnQuery.PerformClick();
        }

        private void btnQuery_Click(object sender, EventArgs e)
        {
            dgRecord.DataSource = LogService.QueryOpLog((OpType)cbOpType.SelectedValue, dtStartTime.Value.Date, dtEndTime.Value.Date);
        }
    }
}
